package com.ktjy.filter;

import com.alibaba.fastjson2.JSONWriter;
import com.alibaba.fastjson2.filter.PropertyPreFilter;

import java.util.Set;

public class FastJson2SensitivePropFilter implements PropertyPreFilter {
    private Set<String> excludes;

    public FastJson2SensitivePropFilter(Set<String> excludes) {
        this.excludes = excludes;
    }

    @Override
    public boolean process(JSONWriter jsonWriter, Object obj, String propertyName) {
        if (excludes == null) {
            return true;
        }
        return !excludes.contains(propertyName);
    }
}
